<?php

function checkAdminPermission($perm, $root, $json = false)
{
    $uid = getSessionUid();
    global $_G;
    if ($_G["permissions"]["isAdmin"]) {
        if (hasPermission("admin.*","admin_groups")) {
            return true;
        }
        if (hasPermission($root,"admin_groups")) {
            return true;
        }
        if (hasPermission($perm,"admin_groups")) {
            return true;
        }
    }
    if ($json) {
        returnMessage("-25", "拒绝访问，你需要$perm 权限才能执行这个操作");
    }
    printMessage("error", "拒绝访问，你需要$perm 权限才能执行这个操作");
    die();
}
?>